//上车地点热力图
var orderStartChart = echarts.init(document.getElementById("orderStart"));
var appOrderStart = {};
option = null;
appOrderStart.title = '热力图与百度地图扩展';
$.ajax({
    type: "POST",
    async: true,
    url: "OrderStartServlet",
    data: {},
    dataType: "json",
    success: function (resultOfOrderStart) {
        var pointsOfStart = [];
        for (var i = 0; i < resultOfOrderStart.length; i++) {
            //pointsOfStart.push([120.4280555506,30.23633761213,1]);
            pointsOfStart.push([resultOfOrderStart[i].longitude, resultOfOrderStart[i].latitude, 1]);
        }

        console.log(pointsOfStart);
        orderStartChart.setOption(option = {
            animation: false,
            bmap: {
                center: [104.09, 30.70],
                zoom: 13,
                roam: true,
                mapStyle: {
                    style:'bluish'
                }
            },
            visualMap: {
                show: false,
                top: 'top',
                min: 0,
                max: 23,
                seriesIndex: 0,
                calculable: true,
                inRange: {
                    color: ['blue', 'blue', 'green', 'yellow', 'red']
                    // color: ['#50A2B9', '#9DB578', '#EAC736', '#E28B4A', '#D94E5D']
                }
            },
            series: [{
                type: 'heatmap',
                coordinateSystem: 'bmap',
                progressiveThreshold: 15000,
                data: pointsOfStart,
                pointSize: 2,
                blurSize: 3
            }]
        });
        if (!appOrderStart.inNode) {
// 添加百度地图插件
            var bmap = orderStartChart.getModel().getComponent('bmap').getBMap();
            bmap.addControl(new BMap.MapTypeControl());
        }
    },
})
;
if (option && typeof option === "object") {
    orderStartChart.setOption(option, true);
}


